package com.sh.config;

import com.sh.utils.IdGeneratorUtil;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import java.util.List;

@Configuration
public class Configure {
    @Value("${rm.work-id}")
    private Long workId;

    @Value("${rm.data-center-id}")
    private Long dataCenterId;


    public static List<String> sysManageAccount;

    public static Integer sysManageFolderLevel;//管理的目录层级，默认管理5层

    @Value("${rm.sys.manage.account}")
    public  void setSysManageAccount(List<String> sysManageAccount) {
        Configure.sysManageAccount = sysManageAccount;
    }

    @Value("${rm.sys.manage.account.folder-level:5}")
    public  void setSysManageFolderLevel(Integer sysManageFolderLevel) {
        Configure.sysManageFolderLevel = sysManageFolderLevel;
    }

    @Bean
    public IdGeneratorUtil idGeneratorUtil() {
        return new IdGeneratorUtil(workId, dataCenterId);
    }

}
